{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Using data directory: C:\\Users\\25354\\.bokeh\\data\n",
      "Skipping 'CGM.csv' (checksum match)\n",
      "Skipping 'US_Counties.zip' (checksum match)\n",
      "Skipping 'us_cities.json' (checksum match)\n",
      "Skipping 'unemployment09.csv' (checksum match)\n",
      "Skipping 'AAPL.csv' (checksum match)\n",
      "Skipping 'FB.csv' (checksum match)\n",
      "Skipping 'GOOG.csv' (checksum match)\n",
      "Skipping 'IBM.csv' (checksum match)\n",
      "Skipping 'MSFT.csv' (checksum match)\n",
      "Skipping 'WPP2012_SA_DB03_POPULATION_QUINQUENNIAL.zip' (checksum match)\n",
      "Skipping 'gapminder_fertility.csv' (checksum match)\n",
      "Skipping 'gapminder_population.csv' (checksum match)\n",
      "Skipping 'gapminder_life_expectancy.csv' (checksum match)\n",
      "Skipping 'gapminder_regions.csv' (checksum match)\n",
      "Skipping 'world_cities.zip' (checksum match)\n",
      "Skipping 'airports.json' (checksum match)\n",
      "Skipping 'movies.db.zip' (checksum match)\n",
      "Skipping 'airports.csv' (checksum match)\n",
      "Skipping 'routes.csv' (checksum match)\n",
      "Skipping 'haarcascade_frontalface_default.xml' (checksum match)\n"
     ]
    }
   ],
   "source": [
    "import bokeh\n",
    "bokeh.sampledata.download()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"1001\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "  var JS_MIME_TYPE = 'application/javascript';\n",
       "  var HTML_MIME_TYPE = 'text/html';\n",
       "  var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
       "  var CLASS_NAME = 'output_bokeh rendered_html';\n",
       "\n",
       "  /**\n",
       "   * Render data to the DOM node\n",
       "   */\n",
       "  function render(props, node) {\n",
       "    var script = document.createElement(\"script\");\n",
       "    node.appendChild(script);\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when an output is cleared or removed\n",
       "   */\n",
       "  function handleClearOutput(event, handle) {\n",
       "    var cell = handle.cell;\n",
       "\n",
       "    var id = cell.output_area._bokeh_element_id;\n",
       "    var server_id = cell.output_area._bokeh_server_id;\n",
       "    // Clean up Bokeh references\n",
       "    if (id != null && id in Bokeh.index) {\n",
       "      Bokeh.index[id].model.document.clear();\n",
       "      delete Bokeh.index[id];\n",
       "    }\n",
       "\n",
       "    if (server_id !== undefined) {\n",
       "      // Clean up Bokeh references\n",
       "      var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
       "      cell.notebook.kernel.execute(cmd, {\n",
       "        iopub: {\n",
       "          output: function(msg) {\n",
       "            var id = msg.content.text.trim();\n",
       "            if (id in Bokeh.index) {\n",
       "              Bokeh.index[id].model.document.clear();\n",
       "              delete Bokeh.index[id];\n",
       "            }\n",
       "          }\n",
       "        }\n",
       "      });\n",
       "      // Destroy server and session\n",
       "      var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
       "      cell.notebook.kernel.execute(cmd);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when a new output is added\n",
       "   */\n",
       "  function handleAddOutput(event, handle) {\n",
       "    var output_area = handle.output_area;\n",
       "    var output = handle.output;\n",
       "\n",
       "    // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
       "    if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
       "      return\n",
       "    }\n",
       "\n",
       "    var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
       "\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
       "      toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
       "      // store reference to embed id on output_area\n",
       "      output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
       "    }\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
       "      var bk_div = document.createElement(\"div\");\n",
       "      bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
       "      var script_attrs = bk_div.children[0].attributes;\n",
       "      for (var i = 0; i < script_attrs.length; i++) {\n",
       "        toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
       "        toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n",
       "      }\n",
       "      // store reference to server id on output_area\n",
       "      output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function register_renderer(events, OutputArea) {\n",
       "\n",
       "    function append_mime(data, metadata, element) {\n",
       "      // create a DOM node to render to\n",
       "      var toinsert = this.create_output_subarea(\n",
       "        metadata,\n",
       "        CLASS_NAME,\n",
       "        EXEC_MIME_TYPE\n",
       "      );\n",
       "      this.keyboard_manager.register_events(toinsert);\n",
       "      // Render to node\n",
       "      var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
       "      render(props, toinsert[toinsert.length - 1]);\n",
       "      element.append(toinsert);\n",
       "      return toinsert\n",
       "    }\n",
       "\n",
       "    /* Handle when an output is cleared or removed */\n",
       "    events.on('clear_output.CodeCell', handleClearOutput);\n",
       "    events.on('delete.Cell', handleClearOutput);\n",
       "\n",
       "    /* Handle when a new output is added */\n",
       "    events.on('output_added.OutputArea', handleAddOutput);\n",
       "\n",
       "    /**\n",
       "     * Register the mime type and append_mime function with output_area\n",
       "     */\n",
       "    OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
       "      /* Is output safe? */\n",
       "      safe: true,\n",
       "      /* Index of renderer in `output_area.display_order` */\n",
       "      index: 0\n",
       "    });\n",
       "  }\n",
       "\n",
       "  // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
       "  if (root.Jupyter !== undefined) {\n",
       "    var events = require('base/js/events');\n",
       "    var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
       "\n",
       "    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
       "      register_renderer(events, OutputArea);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    var el = document.getElementById(\"1001\");\n",
       "    if (el != null) {\n",
       "      el.textContent = \"BokehJS is loading...\";\n",
       "    }\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) {\n",
       "        if (callback != null)\n",
       "          callback();\n",
       "      });\n",
       "    } finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.debug(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(css_urls, js_urls, callback) {\n",
       "    if (css_urls == null) css_urls = [];\n",
       "    if (js_urls == null) js_urls = [];\n",
       "\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = css_urls.length + js_urls.length;\n",
       "\n",
       "    function on_load() {\n",
       "      root._bokeh_is_loading--;\n",
       "      if (root._bokeh_is_loading === 0) {\n",
       "        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n",
       "        run_callbacks()\n",
       "      }\n",
       "    }\n",
       "\n",
       "    function on_error() {\n",
       "      console.error(\"failed to load \" + url);\n",
       "    }\n",
       "\n",
       "    for (var i = 0; i < css_urls.length; i++) {\n",
       "      var url = css_urls[i];\n",
       "      const element = document.createElement(\"link\");\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.rel = \"stylesheet\";\n",
       "      element.type = \"text/css\";\n",
       "      element.href = url;\n",
       "      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n",
       "      document.body.appendChild(element);\n",
       "    }\n",
       "\n",
       "    const hashes = {\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\": \"kLr4fYcqcSpbuI95brIH3vnnYCquzzSxHPU6XGQCIkQRGJwhg0StNbj1eegrHs12\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\": \"xIGPmVtaOm+z0BqfSOMn4lOR6ciex448GIKG4eE61LsAvmGj48XcMQZtKcE/UXZe\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\": \"Dc9u1wF/0zApGIWoBbH77iWEHtdmkuYWG839Uzmv8y8yBLXebjO9ZnERsde5Ln/P\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\": \"cT9JaBz7GiRXdENrJLZNSC6eMNF3nh3fa5fTF51Svp+ukxPdwcU5kGXGPBgDCa2j\"};\n",
       "\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var element = document.createElement('script');\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.async = false;\n",
       "      element.src = url;\n",
       "      if (url in hashes) {\n",
       "        element.crossOrigin = \"anonymous\";\n",
       "        element.integrity = \"sha384-\" + hashes[url];\n",
       "      }\n",
       "      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.head.appendChild(element);\n",
       "    }\n",
       "  };\n",
       "\n",
       "  function inject_raw_css(css) {\n",
       "    const element = document.createElement(\"style\");\n",
       "    element.appendChild(document.createTextNode(css));\n",
       "    document.body.appendChild(element);\n",
       "  }\n",
       "\n",
       "  \n",
       "  var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\"];\n",
       "  var css_urls = [];\n",
       "  \n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "    \n",
       "    \n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if (root.Bokeh !== undefined || force === true) {\n",
       "      \n",
       "    for (var i = 0; i < inline_js.length; i++) {\n",
       "      inline_js[i].call(root, root.Bokeh);\n",
       "    }\n",
       "    if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"1001\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(css_urls, js_urls, function() {\n",
       "      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ],
      "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  var force = true;\n\n  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n    root._bokeh_onload_callbacks = [];\n    root._bokeh_is_loading = undefined;\n  }\n\n  \n\n  \n  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  var NB_LOAD_WARNING = {'data': {'text/html':\n     \"<div style='background-color: #fdd'>\\n\"+\n     \"<p>\\n\"+\n     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n     \"</p>\\n\"+\n     \"<ul>\\n\"+\n     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n     \"</ul>\\n\"+\n     \"<code>\\n\"+\n     \"from bokeh.resources import INLINE\\n\"+\n     \"output_notebook(resources=INLINE)\\n\"+\n     \"</code>\\n\"+\n     \"</div>\"}};\n\n  function display_loaded() {\n    var el = document.getElementById(\"1001\");\n    if (el != null) {\n      el.textContent = \"BokehJS is loading...\";\n    }\n    if (root.Bokeh !== undefined) {\n      if (el != null) {\n        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n      }\n    } else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(display_loaded, 100)\n    }\n  }\n\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n\n    root._bokeh_onload_callbacks.push(callback);\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls == null || js_urls.length === 0) {\n      run_callbacks();\n      return null;\n    }\n    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n    root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n\n    function on_error() {\n      console.error(\"failed to load \" + url);\n    }\n\n    for (var i = 0; i < css_urls.length; i++) {\n      var url = css_urls[i];\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }\n\n    const hashes = {\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\": \"kLr4fYcqcSpbuI95brIH3vnnYCquzzSxHPU6XGQCIkQRGJwhg0StNbj1eegrHs12\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\": \"xIGPmVtaOm+z0BqfSOMn4lOR6ciex448GIKG4eE61LsAvmGj48XcMQZtKcE/UXZe\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\": \"Dc9u1wF/0zApGIWoBbH77iWEHtdmkuYWG839Uzmv8y8yBLXebjO9ZnERsde5Ln/P\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\": \"cT9JaBz7GiRXdENrJLZNSC6eMNF3nh3fa5fTF51Svp+ukxPdwcU5kGXGPBgDCa2j\"};\n\n    for (var i = 0; i < js_urls.length; i++) {\n      var url = js_urls[i];\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      if (url in hashes) {\n        element.crossOrigin = \"anonymous\";\n        element.integrity = \"sha384-\" + hashes[url];\n      }\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n  };\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  \n  var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\"];\n  var css_urls = [];\n  \n\n  var inline_js = [\n    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\n    function(Bokeh) {\n    \n    \n    }\n  ];\n\n  function run_inline_js() {\n    \n    if (root.Bokeh !== undefined || force === true) {\n      \n    for (var i = 0; i < inline_js.length; i++) {\n      inline_js[i].call(root, root.Bokeh);\n    }\n    if (force === true) {\n        display_loaded();\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    } else if (force !== true) {\n      var cell = $(document.getElementById(\"1001\")).parents('.cell').data().cell;\n      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n    }\n\n  }\n\n  if (root._bokeh_is_loading === 0) {\n    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n    run_inline_js();\n  } else {\n    load_libs(css_urls, js_urls, function() {\n      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n      run_inline_js();\n    });\n  }\n}(window));"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.plotting import figure,output_notebook,show\n",
    "output_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"ec43de7e-3c7a-49ef-8a53-8d15a841d3c0\" data-root-id=\"1008\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"460e2083-89cd-4f0c-8470-b5b2f4488a4f\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1019\"}],\"center\":[{\"id\":\"1022\"},{\"id\":\"1026\"},{\"id\":\"1054\"}],\"left\":[{\"id\":\"1023\"}],\"plot_height\":300,\"plot_width\":300,\"renderers\":[{\"id\":\"1044\"}],\"title\":{\"id\":\"1009\"},\"toolbar\":{\"id\":\"1034\"},\"x_range\":{\"id\":\"1011\"},\"x_scale\":{\"id\":\"1015\"},\"y_range\":{\"id\":\"1013\"},\"y_scale\":{\"id\":\"1017\"}},\"id\":\"1008\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1050\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"source\":{\"id\":\"1041\"}},\"id\":\"1045\",\"type\":\"CDSView\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1027\"},{\"id\":\"1028\"},{\"id\":\"1029\"},{\"id\":\"1030\"},{\"id\":\"1031\"},{\"id\":\"1032\"}]},\"id\":\"1034\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1030\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1031\",\"type\":\"ResetTool\"},{\"attributes\":{\"items\":[{\"id\":\"1055\"}]},\"id\":\"1054\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"1027\",\"type\":\"PanTool\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1043\",\"type\":\"Line\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1033\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"1051\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1052\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1013\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1015\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis_label\":\"y\",\"formatter\":{\"id\":\"1050\"},\"ticker\":{\"id\":\"1024\"}},\"id\":\"1023\",\"type\":\"LinearAxis\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5,7,9],\"y\":[6,7,8,5,4,6,4]},\"selected\":{\"id\":\"1052\"},\"selection_policy\":{\"id\":\"1051\"}},\"id\":\"1041\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"overlay\":{\"id\":\"1033\"}},\"id\":\"1029\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"axis\":{\"id\":\"1023\"},\"dimension\":1,\"ticker\":null},\"id\":\"1026\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1048\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1042\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1024\",\"type\":\"BasicTicker\"},{\"attributes\":{\"text\":\"line example\"},\"id\":\"1009\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1011\",\"type\":\"DataRange1d\"},{\"attributes\":{\"axis\":{\"id\":\"1019\"},\"ticker\":null},\"id\":\"1022\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1028\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"1041\"},\"glyph\":{\"id\":\"1042\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1043\"},\"selection_glyph\":null,\"view\":{\"id\":\"1045\"}},\"id\":\"1044\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1020\",\"type\":\"BasicTicker\"},{\"attributes\":{\"label\":{\"value\":\"Temp.\"},\"renderers\":[{\"id\":\"1044\"}]},\"id\":\"1055\",\"type\":\"LegendItem\"},{\"attributes\":{\"axis_label\":\"x\",\"formatter\":{\"id\":\"1048\"},\"ticker\":{\"id\":\"1020\"}},\"id\":\"1019\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1032\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1017\",\"type\":\"LinearScale\"}],\"root_ids\":[\"1008\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"460e2083-89cd-4f0c-8470-b5b2f4488a4f\",\"root_ids\":[\"1008\"],\"roots\":{\"1008\":\"ec43de7e-3c7a-49ef-8a53-8d15a841d3c0\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1008"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 数据\n",
    "x = [1,2,3,4,5,7,9]\n",
    "y = [6,7,8,5,4,6,4]\n",
    "\n",
    "#画布\n",
    "p = figure(\n",
    "    title=\"line example\",\n",
    "    x_axis_label = 'x',\n",
    "    y_axis_label = 'y',\n",
    "    width = 300,\n",
    "    height = 300)\n",
    "\n",
    "#在画布上绘制图形\n",
    "p.line(x, y, legend=\"Temp.\", line_width=2)  # 折线\n",
    "# 显示\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"c5dca3f2-765c-4ee1-9269-5f25881705ca\" data-root-id=\"1178\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"24643775-9cd2-4ada-873e-6529e70bfcfc\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1189\"}],\"center\":[{\"id\":\"1192\"},{\"id\":\"1196\"}],\"left\":[{\"id\":\"1193\"}],\"plot_height\":300,\"plot_width\":300,\"renderers\":[{\"id\":\"1214\"}],\"title\":{\"id\":\"1179\"},\"toolbar\":{\"id\":\"1204\"},\"x_range\":{\"id\":\"1181\"},\"x_scale\":{\"id\":\"1185\"},\"y_range\":{\"id\":\"1183\"},\"y_scale\":{\"id\":\"1187\"}},\"id\":\"1178\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1194\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"1211\"},\"glyph\":{\"id\":\"1212\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1213\"},\"selection_glyph\":null,\"view\":{\"id\":\"1215\"}},\"id\":\"1214\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"line_alpha\":{\"field\":\"line_alpha\"},\"line_color\":{\"field\":\"line_color\"},\"xs\":{\"field\":\"xs\"},\"ys\":{\"field\":\"ys\"}},\"id\":\"1212\",\"type\":\"MultiLine\"},{\"attributes\":{\"text\":\"multi_line\"},\"id\":\"1179\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1181\",\"type\":\"DataRange1d\"},{\"attributes\":{\"source\":{\"id\":\"1211\"}},\"id\":\"1215\",\"type\":\"CDSView\"},{\"attributes\":{\"data\":{\"line_alpha\":[0.4,0.8],\"line_color\":[\"firebrick\",\"navy\"],\"xs\":[[2,4,6,7],[3,5,7,8,9,12]],\"ys\":[[3,4,2,1],[2,4,5,6,7,5]]},\"selected\":{\"id\":\"1230\"},\"selection_policy\":{\"id\":\"1229\"}},\"id\":\"1211\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1198\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1229\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"line_alpha\":{\"value\":0.1},\"line_color\":{\"field\":\"line_color\"},\"xs\":{\"field\":\"xs\"},\"ys\":{\"field\":\"ys\"}},\"id\":\"1213\",\"type\":\"MultiLine\"},{\"attributes\":{},\"id\":\"1187\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1201\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1202\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1183\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1230\",\"type\":\"Selection\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1197\"},{\"id\":\"1198\"},{\"id\":\"1199\"},{\"id\":\"1200\"},{\"id\":\"1201\"},{\"id\":\"1202\"}]},\"id\":\"1204\",\"type\":\"Toolbar\"},{\"attributes\":{\"formatter\":{\"id\":\"1226\"},\"ticker\":{\"id\":\"1190\"}},\"id\":\"1189\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1200\",\"type\":\"SaveTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1203\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"1190\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1226\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"axis\":{\"id\":\"1193\"},\"dimension\":1,\"ticker\":null},\"id\":\"1196\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1197\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1185\",\"type\":\"LinearScale\"},{\"attributes\":{\"formatter\":{\"id\":\"1228\"},\"ticker\":{\"id\":\"1194\"}},\"id\":\"1193\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1228\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"axis\":{\"id\":\"1189\"},\"ticker\":null},\"id\":\"1192\",\"type\":\"Grid\"},{\"attributes\":{\"overlay\":{\"id\":\"1203\"}},\"id\":\"1199\",\"type\":\"BoxZoomTool\"}],\"root_ids\":[\"1178\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"24643775-9cd2-4ada-873e-6529e70bfcfc\",\"root_ids\":[\"1178\"],\"roots\":{\"1178\":\"c5dca3f2-765c-4ee1-9269-5f25881705ca\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1178"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 数据\n",
    "x = [[2,4,6,7],[3,5,7,8,9,12]]\n",
    "y = [[3,4,2,1],[2,4,5,6,7,5]]\n",
    "\n",
    "#画布\n",
    "p = figure(title=\"multi_line\",plot_width=300,plot_height=300)\n",
    "p.multi_line(x,y,color=[\"firebrick\", \"navy\"], alpha=[0.4, 0.8])\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 折线图实践"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 示例代码（数学模型）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"e5c8c21d-d48f-45cc-b72d-c12cae484b27\" data-root-id=\"1280\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"93add347-3666-4ce3-9ddb-23834dc2e354\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1291\"}],\"center\":[{\"id\":\"1294\"},{\"id\":\"1298\"},{\"id\":\"1322\"}],\"left\":[{\"id\":\"1295\"}],\"plot_height\":350,\"plot_width\":700,\"renderers\":[{\"id\":\"1312\"},{\"id\":\"1327\"},{\"id\":\"1342\"},{\"id\":\"1360\"},{\"id\":\"1380\"},{\"id\":\"1401\"}],\"title\":{\"id\":\"1281\"},\"toolbar\":{\"id\":\"1304\"},\"x_range\":{\"id\":\"1283\"},\"x_scale\":{\"id\":\"1287\"},\"y_range\":{\"id\":\"1285\"},\"y_scale\":{\"id\":\"1289\"}},\"id\":\"1280\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1336\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1283\",\"type\":\"DataRange1d\"},{\"attributes\":{\"line_color\":\"red\",\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1358\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1337\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1292\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1395\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1396\",\"type\":\"Selection\"},{\"attributes\":{\"axis_label\":\"particles\",\"formatter\":{\"id\":\"1318\"},\"ticker\":{\"id\":\"1296\"}},\"id\":\"1295\",\"type\":\"LogAxis\"},{\"attributes\":{\"data\":{\"x\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0],\"y\":[1.2589254117941673,3.1622776601683795,10.0,31.622776601683793,100.0,316.22776601683796,1000.0]},\"selected\":{\"id\":\"1396\"},\"selection_policy\":{\"id\":\"1395\"}},\"id\":\"1377\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"axis_label\":\"sections\",\"formatter\":{\"id\":\"1316\"},\"ticker\":{\"id\":\"1292\"}},\"id\":\"1291\",\"type\":\"LinearAxis\"},{\"attributes\":{\"num_minor_ticks\":10},\"id\":\"1296\",\"type\":\"LogTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"1357\"},\"glyph\":{\"id\":\"1358\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1359\"},\"selection_glyph\":null,\"view\":{\"id\":\"1361\"}},\"id\":\"1360\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1289\",\"type\":\"LogScale\"},{\"attributes\":{},\"id\":\"1285\",\"type\":\"DataRange1d\"},{\"attributes\":{\"data\":{\"x\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0],\"y\":[1.2589254117941673,3.1622776601683795,10.0,31.622776601683793,100.0,316.22776601683796,1000.0]},\"selected\":{\"id\":\"1374\"},\"selection_policy\":{\"id\":\"1373\"}},\"id\":\"1357\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1287\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1320\",\"type\":\"Selection\"},{\"attributes\":{\"axis\":{\"id\":\"1291\"},\"ticker\":null},\"id\":\"1294\",\"type\":\"Grid\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1299\"},{\"id\":\"1300\"},{\"id\":\"1301\"},{\"id\":\"1302\"}]},\"id\":\"1304\",\"type\":\"Toolbar\"},{\"attributes\":{\"label\":{\"value\":\"y=10^x\"},\"renderers\":[{\"id\":\"1360\"},{\"id\":\"1380\"}]},\"id\":\"1376\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1359\",\"type\":\"Line\"},{\"attributes\":{\"source\":{\"id\":\"1357\"}},\"id\":\"1361\",\"type\":\"CDSView\"},{\"attributes\":{\"label\":{\"value\":\"y=10^x^2\"},\"renderers\":[{\"id\":\"1401\"}]},\"id\":\"1421\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1310\",\"type\":\"Line\"},{\"attributes\":{\"axis\":{\"id\":\"1295\"},\"dimension\":1,\"ticker\":null},\"id\":\"1298\",\"type\":\"Grid\"},{\"attributes\":{\"ticker\":null},\"id\":\"1318\",\"type\":\"LogTickFormatter\"},{\"attributes\":{},\"id\":\"1373\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1299\",\"type\":\"PanTool\"},{\"attributes\":{\"data_source\":{\"id\":\"1398\"},\"glyph\":{\"id\":\"1399\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1400\"},\"selection_glyph\":null,\"view\":{\"id\":\"1402\"}},\"id\":\"1401\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1374\",\"type\":\"Selection\"},{\"attributes\":{\"items\":[{\"id\":\"1323\"},{\"id\":\"1356\"},{\"id\":\"1376\"},{\"id\":\"1421\"}]},\"id\":\"1322\",\"type\":\"Legend\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":3,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1340\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0],\"y\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0]},\"selected\":{\"id\":\"1320\"},\"selection_policy\":{\"id\":\"1319\"}},\"id\":\"1309\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1418\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"white\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"units\":\"screen\",\"value\":8},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1326\",\"type\":\"Circle\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1311\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0],\"y\":[0.010000000000000002,0.25,1.0,2.25,4.0,6.25,9.0]},\"selected\":{\"id\":\"1354\"},\"selection_policy\":{\"id\":\"1353\"}},\"id\":\"1339\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"overlay\":{\"id\":\"1303\"}},\"id\":\"1300\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"source\":{\"id\":\"1309\"}},\"id\":\"1313\",\"type\":\"CDSView\"},{\"attributes\":{\"source\":{\"id\":\"1398\"}},\"id\":\"1402\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1301\",\"type\":\"ResetTool\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"orange\",\"line_dash\":[4,4],\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1400\",\"type\":\"Line\"},{\"attributes\":{\"label\":{\"value\":\"y=x\"},\"renderers\":[{\"id\":\"1312\"},{\"id\":\"1327\"}]},\"id\":\"1323\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1302\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1419\",\"type\":\"Selection\"},{\"attributes\":{\"source\":{\"id\":\"1339\"}},\"id\":\"1343\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":3,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1341\",\"type\":\"Line\"},{\"attributes\":{\"label\":{\"value\":\"y=x^2\"},\"renderers\":[{\"id\":\"1342\"}]},\"id\":\"1356\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1354\",\"type\":\"Selection\"},{\"attributes\":{\"line_color\":\"orange\",\"line_dash\":[4,4],\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1399\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1353\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1316\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"data_source\":{\"id\":\"1339\"},\"glyph\":{\"id\":\"1340\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1341\"},\"selection_glyph\":null,\"view\":{\"id\":\"1343\"}},\"id\":\"1342\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data\":{\"x\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0],\"y\":[1.023292992280754,1.7782794100389228,10.0,177.82794100389228,10000.0,1778279.410038923,1000000000.0]},\"selected\":{\"id\":\"1419\"},\"selection_policy\":{\"id\":\"1418\"}},\"id\":\"1398\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"1324\"},\"glyph\":{\"id\":\"1325\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1326\"},\"selection_glyph\":null,\"view\":{\"id\":\"1328\"}},\"id\":\"1327\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"1324\"}},\"id\":\"1328\",\"type\":\"CDSView\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1303\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"fill_color\":{\"value\":\"red\"},\"line_color\":{\"value\":\"red\"},\"size\":{\"units\":\"screen\",\"value\":6},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1378\",\"type\":\"Circle\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"red\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"red\"},\"size\":{\"units\":\"screen\",\"value\":6},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1379\",\"type\":\"Circle\"},{\"attributes\":{\"data_source\":{\"id\":\"1309\"},\"glyph\":{\"id\":\"1310\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1311\"},\"selection_glyph\":null,\"view\":{\"id\":\"1313\"}},\"id\":\"1312\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1319\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"data_source\":{\"id\":\"1377\"},\"glyph\":{\"id\":\"1378\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1379\"},\"selection_glyph\":null,\"view\":{\"id\":\"1381\"}},\"id\":\"1380\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_color\":{\"value\":\"white\"},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"units\":\"screen\",\"value\":8},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1325\",\"type\":\"Circle\"},{\"attributes\":{\"source\":{\"id\":\"1377\"}},\"id\":\"1381\",\"type\":\"CDSView\"},{\"attributes\":{\"text\":\"log axis example\"},\"id\":\"1281\",\"type\":\"Title\"},{\"attributes\":{\"data\":{\"x\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0],\"y\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0]},\"selected\":{\"id\":\"1337\"},\"selection_policy\":{\"id\":\"1336\"}},\"id\":\"1324\",\"type\":\"ColumnDataSource\"}],\"root_ids\":[\"1280\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"93add347-3666-4ce3-9ddb-23834dc2e354\",\"root_ids\":[\"1280\"],\"roots\":{\"1280\":\"e5c8c21d-d48f-45cc-b72d-c12cae484b27\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1280"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = [0.1, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]\n",
    "y0 = [i**2 for i in x]\n",
    "y1 = [10**i for i in x]\n",
    "y2 = [10**(i**2) for i in x]\n",
    "\n",
    "p = figure(\n",
    "    tools=\"pan,box_zoom,reset,save\",\n",
    "    y_axis_type=\"log\", title=\"log axis example\",\n",
    "    x_axis_label='sections', y_axis_label='particles',\n",
    "    width=700, height=350) \n",
    "\n",
    "\n",
    "p.line(x, x, legend=\"y=x\")\n",
    "p.circle(x, x, legend=\"y=x\", fill_color=\"white\", size=8)\n",
    "p.line(x, y0, legend=\"y=x^2\", line_width=3)\n",
    "p.line(x, y1, legend=\"y=10^x\", line_color=\"red\")\n",
    "p.circle(x, y1, legend=\"y=10^x\", fill_color=\"red\", line_color=\"red\", size=6)\n",
    "p.line(x, y2, legend=\"y=10^x^2\", line_color=\"orange\", line_dash=\"4 4\")\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"c7016f81-0ef3-460d-a5e3-a40e4e220e2a\" data-root-id=\"1280\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"1aefe717-4b32-47c4-b95b-363d75d41405\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1291\"}],\"center\":[{\"id\":\"1294\"},{\"id\":\"1298\"},{\"id\":\"1322\"}],\"left\":[{\"id\":\"1295\"}],\"plot_height\":350,\"plot_width\":700,\"renderers\":[{\"id\":\"1312\"},{\"id\":\"1327\"},{\"id\":\"1342\"},{\"id\":\"1360\"},{\"id\":\"1380\"},{\"id\":\"1401\"}],\"title\":{\"id\":\"1281\"},\"toolbar\":{\"id\":\"1304\"},\"x_range\":{\"id\":\"1283\"},\"x_scale\":{\"id\":\"1287\"},\"y_range\":{\"id\":\"1285\"},\"y_scale\":{\"id\":\"1289\"}},\"id\":\"1280\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1336\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1283\",\"type\":\"DataRange1d\"},{\"attributes\":{\"line_color\":\"red\",\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1358\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1337\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1292\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1395\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1396\",\"type\":\"Selection\"},{\"attributes\":{\"axis_label\":\"particles\",\"formatter\":{\"id\":\"1318\"},\"ticker\":{\"id\":\"1296\"}},\"id\":\"1295\",\"type\":\"LogAxis\"},{\"attributes\":{\"data\":{\"x\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0],\"y\":[1.2589254117941673,3.1622776601683795,10.0,31.622776601683793,100.0,316.22776601683796,1000.0]},\"selected\":{\"id\":\"1396\"},\"selection_policy\":{\"id\":\"1395\"}},\"id\":\"1377\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"axis_label\":\"sections\",\"formatter\":{\"id\":\"1316\"},\"ticker\":{\"id\":\"1292\"}},\"id\":\"1291\",\"type\":\"LinearAxis\"},{\"attributes\":{\"num_minor_ticks\":10},\"id\":\"1296\",\"type\":\"LogTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"1357\"},\"glyph\":{\"id\":\"1358\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1359\"},\"selection_glyph\":null,\"view\":{\"id\":\"1361\"}},\"id\":\"1360\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1289\",\"type\":\"LogScale\"},{\"attributes\":{},\"id\":\"1285\",\"type\":\"DataRange1d\"},{\"attributes\":{\"data\":{\"x\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0],\"y\":[1.2589254117941673,3.1622776601683795,10.0,31.622776601683793,100.0,316.22776601683796,1000.0]},\"selected\":{\"id\":\"1374\"},\"selection_policy\":{\"id\":\"1373\"}},\"id\":\"1357\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1287\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1320\",\"type\":\"Selection\"},{\"attributes\":{\"axis\":{\"id\":\"1291\"},\"ticker\":null},\"id\":\"1294\",\"type\":\"Grid\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1299\"},{\"id\":\"1300\"},{\"id\":\"1301\"},{\"id\":\"1302\"}]},\"id\":\"1304\",\"type\":\"Toolbar\"},{\"attributes\":{\"label\":{\"value\":\"y=10^x\"},\"renderers\":[{\"id\":\"1360\"},{\"id\":\"1380\"}]},\"id\":\"1376\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1359\",\"type\":\"Line\"},{\"attributes\":{\"source\":{\"id\":\"1357\"}},\"id\":\"1361\",\"type\":\"CDSView\"},{\"attributes\":{\"label\":{\"value\":\"y=10^x^2\"},\"renderers\":[{\"id\":\"1401\"}]},\"id\":\"1421\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1310\",\"type\":\"Line\"},{\"attributes\":{\"axis\":{\"id\":\"1295\"},\"dimension\":1,\"ticker\":null},\"id\":\"1298\",\"type\":\"Grid\"},{\"attributes\":{\"ticker\":null},\"id\":\"1318\",\"type\":\"LogTickFormatter\"},{\"attributes\":{},\"id\":\"1373\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1299\",\"type\":\"PanTool\"},{\"attributes\":{\"data_source\":{\"id\":\"1398\"},\"glyph\":{\"id\":\"1399\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1400\"},\"selection_glyph\":null,\"view\":{\"id\":\"1402\"}},\"id\":\"1401\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1374\",\"type\":\"Selection\"},{\"attributes\":{\"click_policy\":\"hide\",\"items\":[{\"id\":\"1323\"},{\"id\":\"1356\"},{\"id\":\"1376\"},{\"id\":\"1421\"}],\"location\":\"top_left\"},\"id\":\"1322\",\"type\":\"Legend\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":3,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1340\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0],\"y\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0]},\"selected\":{\"id\":\"1320\"},\"selection_policy\":{\"id\":\"1319\"}},\"id\":\"1309\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1418\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"white\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"units\":\"screen\",\"value\":8},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1326\",\"type\":\"Circle\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1311\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0],\"y\":[0.010000000000000002,0.25,1.0,2.25,4.0,6.25,9.0]},\"selected\":{\"id\":\"1354\"},\"selection_policy\":{\"id\":\"1353\"}},\"id\":\"1339\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"overlay\":{\"id\":\"1303\"}},\"id\":\"1300\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"source\":{\"id\":\"1309\"}},\"id\":\"1313\",\"type\":\"CDSView\"},{\"attributes\":{\"source\":{\"id\":\"1398\"}},\"id\":\"1402\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1301\",\"type\":\"ResetTool\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"orange\",\"line_dash\":[4,4],\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1400\",\"type\":\"Line\"},{\"attributes\":{\"label\":{\"value\":\"y=x\"},\"renderers\":[{\"id\":\"1312\"},{\"id\":\"1327\"}]},\"id\":\"1323\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1302\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1419\",\"type\":\"Selection\"},{\"attributes\":{\"source\":{\"id\":\"1339\"}},\"id\":\"1343\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":3,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1341\",\"type\":\"Line\"},{\"attributes\":{\"label\":{\"value\":\"y=x^2\"},\"renderers\":[{\"id\":\"1342\"}]},\"id\":\"1356\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1354\",\"type\":\"Selection\"},{\"attributes\":{\"line_color\":\"orange\",\"line_dash\":[4,4],\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1399\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1353\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1316\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"data_source\":{\"id\":\"1339\"},\"glyph\":{\"id\":\"1340\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1341\"},\"selection_glyph\":null,\"view\":{\"id\":\"1343\"}},\"id\":\"1342\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data\":{\"x\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0],\"y\":[1.023292992280754,1.7782794100389228,10.0,177.82794100389228,10000.0,1778279.410038923,1000000000.0]},\"selected\":{\"id\":\"1419\"},\"selection_policy\":{\"id\":\"1418\"}},\"id\":\"1398\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"1324\"},\"glyph\":{\"id\":\"1325\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1326\"},\"selection_glyph\":null,\"view\":{\"id\":\"1328\"}},\"id\":\"1327\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"1324\"}},\"id\":\"1328\",\"type\":\"CDSView\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1303\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"fill_color\":{\"value\":\"red\"},\"line_color\":{\"value\":\"red\"},\"size\":{\"units\":\"screen\",\"value\":6},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1378\",\"type\":\"Circle\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"red\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"red\"},\"size\":{\"units\":\"screen\",\"value\":6},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1379\",\"type\":\"Circle\"},{\"attributes\":{\"data_source\":{\"id\":\"1309\"},\"glyph\":{\"id\":\"1310\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1311\"},\"selection_glyph\":null,\"view\":{\"id\":\"1313\"}},\"id\":\"1312\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1319\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"data_source\":{\"id\":\"1377\"},\"glyph\":{\"id\":\"1378\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1379\"},\"selection_glyph\":null,\"view\":{\"id\":\"1381\"}},\"id\":\"1380\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_color\":{\"value\":\"white\"},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"units\":\"screen\",\"value\":8},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1325\",\"type\":\"Circle\"},{\"attributes\":{\"source\":{\"id\":\"1377\"}},\"id\":\"1381\",\"type\":\"CDSView\"},{\"attributes\":{\"text\":\"log axis example\"},\"id\":\"1281\",\"type\":\"Title\"},{\"attributes\":{\"data\":{\"x\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0],\"y\":[0.1,0.5,1.0,1.5,2.0,2.5,3.0]},\"selected\":{\"id\":\"1337\"},\"selection_policy\":{\"id\":\"1336\"}},\"id\":\"1324\",\"type\":\"ColumnDataSource\"}],\"root_ids\":[\"1280\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"1aefe717-4b32-47c4-b95b-363d75d41405\",\"root_ids\":[\"1280\"],\"roots\":{\"1280\":\"c7016f81-0ef3-460d-a5e3-a40e4e220e2a\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1280"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "p.legend.location = \"top_left\"\n",
    "p.legend.click_policy = \"hide\"\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "from bokeh.models import ColumnDataSource, NumeralTickFormatter, SingleIntervalTicker\n",
    "from bokeh.sampledata.us_marriages_divorces import data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Year</th>\n",
       "      <th>Marriages</th>\n",
       "      <th>Divorces</th>\n",
       "      <th>Population</th>\n",
       "      <th>Marriages_per_1000</th>\n",
       "      <th>Divorces_per_1000</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1867</td>\n",
       "      <td>357000.0</td>\n",
       "      <td>10000.0</td>\n",
       "      <td>36970000</td>\n",
       "      <td>9.7</td>\n",
       "      <td>0.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1868</td>\n",
       "      <td>345000.0</td>\n",
       "      <td>10000.0</td>\n",
       "      <td>37885000</td>\n",
       "      <td>9.1</td>\n",
       "      <td>0.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1869</td>\n",
       "      <td>348000.0</td>\n",
       "      <td>11000.0</td>\n",
       "      <td>38870000</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1870</td>\n",
       "      <td>352000.0</td>\n",
       "      <td>11000.0</td>\n",
       "      <td>39905000</td>\n",
       "      <td>8.8</td>\n",
       "      <td>0.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1871</td>\n",
       "      <td>359000.0</td>\n",
       "      <td>12000.0</td>\n",
       "      <td>41010000</td>\n",
       "      <td>8.8</td>\n",
       "      <td>0.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>140</th>\n",
       "      <td>2007</td>\n",
       "      <td>2197000.0</td>\n",
       "      <td>856000.0</td>\n",
       "      <td>301696000</td>\n",
       "      <td>7.3</td>\n",
       "      <td>2.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>141</th>\n",
       "      <td>2008</td>\n",
       "      <td>2157000.0</td>\n",
       "      <td>844000.0</td>\n",
       "      <td>304543000</td>\n",
       "      <td>7.1</td>\n",
       "      <td>2.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>142</th>\n",
       "      <td>2009</td>\n",
       "      <td>2080000.0</td>\n",
       "      <td>840000.0</td>\n",
       "      <td>307240000</td>\n",
       "      <td>6.8</td>\n",
       "      <td>2.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>143</th>\n",
       "      <td>2010</td>\n",
       "      <td>2096000.0</td>\n",
       "      <td>872000.0</td>\n",
       "      <td>309776000</td>\n",
       "      <td>6.8</td>\n",
       "      <td>2.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>144</th>\n",
       "      <td>2011</td>\n",
       "      <td>2118000.0</td>\n",
       "      <td>877000.0</td>\n",
       "      <td>312034000</td>\n",
       "      <td>6.8</td>\n",
       "      <td>2.8</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>145 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Year  Marriages  Divorces  Population  Marriages_per_1000  \\\n",
       "0    1867   357000.0   10000.0    36970000                 9.7   \n",
       "1    1868   345000.0   10000.0    37885000                 9.1   \n",
       "2    1869   348000.0   11000.0    38870000                 9.0   \n",
       "3    1870   352000.0   11000.0    39905000                 8.8   \n",
       "4    1871   359000.0   12000.0    41010000                 8.8   \n",
       "..    ...        ...       ...         ...                 ...   \n",
       "140  2007  2197000.0  856000.0   301696000                 7.3   \n",
       "141  2008  2157000.0  844000.0   304543000                 7.1   \n",
       "142  2009  2080000.0  840000.0   307240000                 6.8   \n",
       "143  2010  2096000.0  872000.0   309776000                 6.8   \n",
       "144  2011  2118000.0  877000.0   312034000                 6.8   \n",
       "\n",
       "     Divorces_per_1000  \n",
       "0                  0.3  \n",
       "1                  0.3  \n",
       "2                  0.3  \n",
       "3                  0.3  \n",
       "4                  0.3  \n",
       "..                 ...  \n",
       "140                2.8  \n",
       "141                2.8  \n",
       "142                2.7  \n",
       "143                2.8  \n",
       "144                2.8  \n",
       "\n",
       "[145 rows x 6 columns]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Year</th>\n",
       "      <th>Marriages</th>\n",
       "      <th>Divorces</th>\n",
       "      <th>Population</th>\n",
       "      <th>Marriages_per_1000</th>\n",
       "      <th>Divorces_per_1000</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1867</td>\n",
       "      <td>357000.0</td>\n",
       "      <td>10000.0</td>\n",
       "      <td>36970000</td>\n",
       "      <td>9.7</td>\n",
       "      <td>0.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1868</td>\n",
       "      <td>345000.0</td>\n",
       "      <td>10000.0</td>\n",
       "      <td>37885000</td>\n",
       "      <td>9.1</td>\n",
       "      <td>0.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1869</td>\n",
       "      <td>348000.0</td>\n",
       "      <td>11000.0</td>\n",
       "      <td>38870000</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1870</td>\n",
       "      <td>352000.0</td>\n",
       "      <td>11000.0</td>\n",
       "      <td>39905000</td>\n",
       "      <td>8.8</td>\n",
       "      <td>0.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1871</td>\n",
       "      <td>359000.0</td>\n",
       "      <td>12000.0</td>\n",
       "      <td>41010000</td>\n",
       "      <td>8.8</td>\n",
       "      <td>0.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>140</th>\n",
       "      <td>2007</td>\n",
       "      <td>2197000.0</td>\n",
       "      <td>856000.0</td>\n",
       "      <td>301696000</td>\n",
       "      <td>7.3</td>\n",
       "      <td>2.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>141</th>\n",
       "      <td>2008</td>\n",
       "      <td>2157000.0</td>\n",
       "      <td>844000.0</td>\n",
       "      <td>304543000</td>\n",
       "      <td>7.1</td>\n",
       "      <td>2.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>142</th>\n",
       "      <td>2009</td>\n",
       "      <td>2080000.0</td>\n",
       "      <td>840000.0</td>\n",
       "      <td>307240000</td>\n",
       "      <td>6.8</td>\n",
       "      <td>2.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>143</th>\n",
       "      <td>2010</td>\n",
       "      <td>2096000.0</td>\n",
       "      <td>872000.0</td>\n",
       "      <td>309776000</td>\n",
       "      <td>6.8</td>\n",
       "      <td>2.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>144</th>\n",
       "      <td>2011</td>\n",
       "      <td>2118000.0</td>\n",
       "      <td>877000.0</td>\n",
       "      <td>312034000</td>\n",
       "      <td>6.8</td>\n",
       "      <td>2.8</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>145 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Year  Marriages  Divorces  Population  Marriages_per_1000  \\\n",
       "0    1867   357000.0   10000.0    36970000                 9.7   \n",
       "1    1868   345000.0   10000.0    37885000                 9.1   \n",
       "2    1869   348000.0   11000.0    38870000                 9.0   \n",
       "3    1870   352000.0   11000.0    39905000                 8.8   \n",
       "4    1871   359000.0   12000.0    41010000                 8.8   \n",
       "..    ...        ...       ...         ...                 ...   \n",
       "140  2007  2197000.0  856000.0   301696000                 7.3   \n",
       "141  2008  2157000.0  844000.0   304543000                 7.1   \n",
       "142  2009  2080000.0  840000.0   307240000                 6.8   \n",
       "143  2010  2096000.0  872000.0   309776000                 6.8   \n",
       "144  2011  2118000.0  877000.0   312034000                 6.8   \n",
       "\n",
       "     Divorces_per_1000  \n",
       "0                  0.3  \n",
       "1                  0.3  \n",
       "2                  0.3  \n",
       "3                  0.3  \n",
       "4                  0.3  \n",
       "..                 ...  \n",
       "140                2.8  \n",
       "141                2.8  \n",
       "142                2.7  \n",
       "143                2.8  \n",
       "144                2.8  \n",
       "\n",
       "[145 rows x 6 columns]"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = data.interpolate(method='linear', axis=0).ffill().bfill()\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
